package cn.chen.controller;

import cn.chen.model.Pay;
import cn.chen.service.PayService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hbpu
 * @since 2023-05-28
 */
@RestController
@RequestMapping("/pay")
public class PayController {

    @Autowired
    private PayService payService;

    //跟据用户id查询用户的所有支付记录
    @RequestMapping("/getPaysByUid")
    public List<Pay> getPaysByUid(Integer uid) {
        LambdaQueryWrapper<Pay> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Pay::getUid, uid);
        return payService.list(wrapper);
    }
}
